<template>
	<view class="container">
		<view class="navigation-top">
			<view class="userInfo">
				<image :src="avatar" mode='scaleToFill' style="width: 64px; height: 64px;"></image>
				<view class="userName">
					<view>{{user.nickName}}</view>
					<view>{{huoBan}}</view>
				</view>
			</view>
			<view class="row navigation-top-font">
				<view>{{yuLei}}</view>
				<view>{{leiJiShouYi}}</view>
			</view>
			<view class="row">
				<view>余额/提现</view>
				<view>累计收益</view>
			</view>
		</view>
		<!-- <image src="{{imageUrl}}" mode="aspectFill" style="width:100%; height:100vh;"></image> -->

		<uni-card padding="0" spacing="0">
			<uni-list>
				<view class="item1" @tap="goPartner">
					<view class="item1-1">
						<image src="/static/navigation/小伙伴.png" mode='scaleToFill' style="width: 28px; height: 26px;">
						</image>
						<text>我的伙伴</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>

				<view class="item1"  @tap="goMerchant">
					<view class="item1-1">
						<image src="/static/navigation/商户管理.png" mode='scaleToFill' style="width: 28px; height: 26px;">
						</image>
						<text>商户管理</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>

				<view class="item1" @tap="goDevice">
					<view class="item1-1">
						<image src="/static/navigation/设备设备管理.png" mode='scaleToFill'
							style="width: 28px; height: 26px;"></image>
						<text>设备管理</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>

				<view class="item1" @tap="goOrder">
					<view class="item1-1">
						<image src="/static/navigation/订单管理.png" mode='scaleToFill' style="width: 28px; height: 26px;">
						</image>
						<text>订单数据</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>
				<view class="item1" v-if="checkRole(['admin'])" @tap="goSetMeal">
					<view class="item1-1">
						<image src="/static/navigation/套餐.png" mode='scaleToFill' style="width: 28px; height: 26px;">
						</image>
						<text>套餐管理</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>


				<view class="item1"  @tap="goSupport">
					<view class="item1-1">
						<image src="/static/navigation/联系客服.png" mode='scaleToFill' style="width: 28px; height: 26px;">
						</image>
						<text>联系客服</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>


				<view class="item1" @click="handleToPwd">
					<view class="item1-1">
						<image src="/static/navigation/修改密码.png" mode='scaleToFill' style="width: 28px; height: 26px;">
						</image>
						<text>修改密码</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>




				
				<view class="item1"  @tap="goShipment">
					<view class="item1-1">
						<image src="/static/navigation/发货管理.png" mode='scaleToFill' style="width: 28px; height: 26px;">
						</image>
						<text>发货审批</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>
				
				
				<view class="item1">
					<view class="item1-1">
						<image src="/static/navigation/白名单评级.png" mode='scaleToFill' style="width: 28px; height: 26px;">
						</image>
						<text>加白名单</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>
				
				
				<view class="item1" v-if="checkRole(['admin'])" >
					<view class="item1-1">
						<image src="/static/navigation/收款账户.png" mode='scaleToFill' style="width: 28px; height: 26px;">
						</image>
						<text>收款账户</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>


				<view class="item2" @click="handleLogout">
					<view class="item1-1">
						<image src="/static/navigation/退出登录.png" mode='scaleToFill' style="width: 28px; height: 26px;">
						</image>
						<text>退出登录</text>
					</view>
					<uni-icons type="right" size="20" color="#bbc4d5"></uni-icons>
				</view>



			</uni-list>

		</uni-card>

	</view>



</template>


<script>
	import {
		getUserProfile
	} from "@/api/system/user"
	import {
		checkPermi,
		checkRole
	} from "@/utils/permission"; // 权限判断函数
	export default {
		data() {
			return {
				user: {},
				roleGroup: "",
				postGroup: "",
				imageUrl: '/static/navigation/用户头像.png',
				yuLei: 3453,
				leiJiShouYi: 99912,
				userName: '游建林',
				huoBan: 'Tx3432fwewe222',
				avatar: '/static/navigation/用户头像.png',

			}
		},

		onLoad() {
			this.getUser()
		},
		methods: {
			checkPermi,
			checkRole,
			getUser() {
				getUserProfile().then(response => {
//					console.log(JSON.stringify(response))
					this.user = response.data
					this.roleGroup = response.roleGroup
					this.postGroup = response.postGroup
				})
			},

goSupport(){
	uni.navigateTo({
		url: '/pages/support/support'
	})
},

			goPartner() {
				uni.navigateTo({
					url: '/pages/partner/index'
				})
			},
			
			goMerchant(){
				uni.navigateTo({
					url: '/pages/merchant/merchant'
				})
			},
			goDevice() {
				uni.navigateTo({
					url: '/pages/device/device'
				})
			},
			
			goOrder() {
				uni.navigateTo({
					url: '/pages/order/order'
				})
			},
			
			goSetMeal(){
				uni.navigateTo({
					url: '/pages/setMeal/setMeal'
				})
			},
			
			
			goShipment(){
				uni.navigateTo({
					url: '/pages/shipment/shipment'
				})
			},
			
			handleToPwd() {
				this.$tab.navigateTo('/pages/mine/pwd/index')
			},
			handleLogout() {
				this.$modal.confirm('确定注销并退出系统吗？').then(() => {
					this.$store.dispatch('LogOut').then(() => {
						this.$tab.reLaunch('/pages/index')
					})
				})
			},

			actionsClick(text) {
				uni.showToast({
					title: text,
					icon: 'none'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {

				background: linear-gradient(180deg, #f0f0f0 0%, #d0eaff 100%);
				height: 100vh;
	}
	.navigation-top {
		color: #ffffff;
		box-shadow: 5px 5px #dad8d8;
		margin: auto;
		margin-top: 15px;
		margin-bottom: 15px;
		width: 91%;
		border-radius: 10px;
		// background-color:rgb(236, 227, 98);
		background-color: #36a6e0;

		// background-color:#65ffcc;
		display: flex;
		flex-direction: column;
		padding: 16px;

		.row {
			display: flex;
			justify-content: space-around;
			height: 26px;
		}
	}

	.userInfo {
		display: flex;
		justify-content: left;

		.userName {
			display: flex;
			flex-direction: column;
			justify-content: center;
			margin-left: 10px;
		}

		margin-bottom: 20px;
	}

	.navigation-top-font {
		font-size: 28px;
		color: rgb(242, 176, 22)
	}

	.item1 {
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 2px solid #f0f0f0;
		/* 设置下边框为2像素的黑色实线 */
		padding: 10px;
		/* 添加一些内边距 */

		.item1-1 {
			display: flex;
			align-items: center;
		}

		image {
			margin-right: 6px;
			margin-left: 6px;
		}

	}


	.item2 {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 10px;
		/* 添加一些内边距 */

		.item1-1 {
			display: flex;
			align-items: center;
		}

		image {
			margin-right: 6px;
			margin-left: 6px;
		}
	}
</style>